package com.cf.service.impl;

import com.cf.dao.PowerDao;
import com.cf.entity.Power;
import com.cf.service.PowerService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
@Service
@Transactional
public class PowerServiceImpl implements PowerService {
    @Autowired
    private PowerDao powerDao;

    @Override
    public PageInfo<Power> selectPowers(int pagenum, int pagesize, Map map) {
        PageHelper.startPage(pagenum,pagesize);
        List<Power> powers = powerDao.selectPowers(map);
        PageInfo<Power> pageInfo = new PageInfo<>(powers);
        return pageInfo;
    }

    @Override
    public List<Power> selectOneTwoPower() {
        return powerDao.selectOneTwoPower();
    }

    @Override
    public List<Power> selectPowersByUid(long id) {
        return powerDao.selectPowersByUid(id);
    }

    @Override
    public List<Power> selectPower(long roleid) {
        return powerDao.selectPower(roleid);
    }
}
